﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using System.Runtime.InteropServices;
using Microsoft.Xna.Framework.Graphics;

namespace Ultima.Xna.Graphics
{
    [StructLayout(LayoutKind.Sequential)]
    public class VertexPositionNormalTextureIndex
    {
        public Vector3 Position;
        public Vector3 Normal;
        public Vector2 TexCoord;
        public int Index;

        public VertexPositionNormalTextureIndex(Vector3 position, Vector3 normal, Vector2 texCoord, int index)
        {
            Position = position;
            Normal = normal;
            TexCoord = texCoord;
            Index = index;
        }

        public static int SizeInBytes { get { return 9 * sizeof(float); } }

        public static VertexElement[] VertexElements = new VertexElement[] {
            new VertexElement(0, sizeof(float) * 0, VertexElementFormat.Vector3, VertexElementMethod.Default, VertexElementUsage.Position, 0),
            new VertexElement(0, sizeof(float) * 3, VertexElementFormat.Vector3, VertexElementMethod.Default, VertexElementUsage.Normal, 0),
            new VertexElement(0, sizeof(float) * 6, VertexElementFormat.Vector2, VertexElementMethod.Default, VertexElementUsage.TextureCoordinate, 0),
            new VertexElement(0, sizeof(float) * 8, VertexElementFormat.Single, VertexElementMethod.Default, VertexElementUsage.TextureCoordinate, 1),
        };
    }
}
